package org.jsola.hr.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.dto.ConfirmLeaveOfficeDTO;
import org.jsola.hr.dto.EmpChangesAddDTO;
import org.jsola.hr.dto.EmpChangesUpdateDTO;
import org.jsola.hr.dto.excel.EmpChangeImportDTO;
import org.jsola.hr.query.EmpChangesQuery;
import org.jsola.hr.vo.*;
import org.jsola.hr.vo.excel.ParseResultVO;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.util.List;

/**
 * @author zhr
 */
@Api(tags = "hr-员工人事变动记录")
public interface IEmpChangesControllerAPI {

    /**
     * 新增员工人事变动记录
     *
     * @param empChangesAddDTO 员工人事变动记录新增实体
     * @return 员工人事变动记录展示对象
     */
    @ApiOperation(value = "新增员工人事变动记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesAddDTO", dataType = "EmpChangesAddDTO", value = "新增员工人事变动记录", paramType = "body")
    })
    Result<EmpChangesVO> save(EmpChangesAddDTO empChangesAddDTO);


    /**
     * 修改员工人事变动记录
     *
     * @param empChangesUpdateDTO 员工人事变动记录
     * @return 更新数量
     */
    @ApiOperation(value = "修改员工人事变动记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesUpdateDTO", dataType = "EmpChangesUpdateDTO", value = "修改员工人事变动记录", paramType = "body")
    })
    Result<Integer> update(EmpChangesUpdateDTO empChangesUpdateDTO);


    /**
     * 删除单个员工人事变动记录，彻底删除
     *
     * @param empChangesId 员工人事变动记录id
     * @return 删除数量
     */
    @ApiOperation(value = "删除单个员工人事变动记录，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesId", dataType = "String", value = "员工人事变动记录id", paramType = "path")
    })
    Result<Integer> delete(String empChangesId);


    /**
     * 批量删除员工人事变动记录，彻底删除
     *
     * @param empChangesIds 员工人事变动记录id集合
     * @return 删除数量
     */
    @ApiOperation(value = "批量删除员工人事变动记录，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesIds", dataType = "String[]", value = "员工人事变动记录id数组", paramType = "body", allowMultiple = true)
    })
    Result<Integer> deleteBatch(String[] empChangesIds);


    /**
     * 根据员工人事变动记录id查询员工人事变动记录详情
     *
     * @param empChangesId 员工人事变动记录id
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "根据员工人事变动记录id查询员工人事变动记录详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesId", dataType = "String", value = "员工人事变动记录id", paramType = "path")
    })
    Result<EmpChangesVO> findById(String empChangesId);


    /**
     * 查询员工人事变动记录
     *
     * @param empChangesQuery 员工人事变动记录查询参数
     * @return page
     */
    @ApiOperation(value = "查询员工人事变动记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesQuery", dataType = "EmpChangesQuery", value = "员工人事变动记录查询参数", paramType = "query")
    })
    Result<List<EmpChangesListVO>> listAll(EmpChangesQuery empChangesQuery);


    /**
     * 分页查询员工人事变动记录
     *
     * @param empChangesQuery 员工人事变动记录查询参数
     * @return page
     */
    @ApiOperation(value = "分页查询员工人事变动记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesQuery", dataType = "EmpChangesQuery", value = "员工人事变动记录查询参数", paramType = "query")
    })
    Result<Page<EmpChangesListVO>> page(EmpChangesQuery empChangesQuery);

    /**
     * 转正式
     *
     * @param empChangesAddDTO 转正式信息
     * @return 转正式结果
     */
    @ApiOperation(value = "转正式")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesAddDTO", dataType = "EmpChangesAddDTO", value = "转正式", paramType = "body")
    })
    Result<EmpChangesVO> transferFormal(@Valid @RequestBody EmpChangesAddDTO empChangesAddDTO);

    /**
     * 批量转正
     *
     * @param empChangesAddDTO 转正信息
     * @return 转正结果
     */
    @ApiOperation(value = "批量转正")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesAddDTO", dataType = "EmpChangesAddDTO", value = "转正", paramType = "body")
    })
    Result<String> batchTransferRegular(@Valid @RequestBody EmpChangesAddDTO empChangesAddDTO);

    /**
     * 转正
     *
     * @param empChangesAddDTO 转正信息
     * @return 转正结果
     */
    @ApiOperation(value = "转正")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesAddDTO", dataType = "EmpChangesAddDTO", value = "转正", paramType = "body")
    })
    Result<String> transferRegular(@Valid @RequestBody EmpChangesAddDTO empChangesAddDTO);

    /**
     * 批量调岗
     *
     * @param empChangesAddDTO 调岗信息
     * @return 调岗结果
     */
    @ApiOperation(value = "批量调岗")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesAddDTO", dataType = "EmpChangesAddDTO", value = "调岗", paramType = "body")
    })
    Result<String> batchTransferPosition(@Valid @RequestBody EmpChangesAddDTO empChangesAddDTO);


    /**
     * 调岗
     *
     * @param empChangesAddDTO 调岗信息
     * @return 调岗结果
     */
    @ApiOperation(value = "调岗")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesAddDTO", dataType = "EmpChangesAddDTO", value = "调岗", paramType = "body")
    })
    Result<String> transferPosition(@Valid @RequestBody EmpChangesAddDTO empChangesAddDTO);

    /**
     * 确认调岗
     *
     * @param empChangesId 员工人事变动记录id
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "确认调岗")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesId", dataType = "String", value = "员工人事变动记录id", paramType = "path")
    })
    Result<Integer> confirmTransferPosition(String empChangesId);

    /**
     * 撤销调岗
     *
     * @param empChangesId 员工人事变动记录id
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "撤销调岗")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesId", dataType = "String", value = "员工人事变动记录id", paramType = "path")
    })
    Result<String> revokeTransferPosition(String empChangesId);

    /**
     * 确认调岗
     *
     * @param empId 员工id
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "根据员工id确认调岗")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empId", dataType = "String", value = "员工id", paramType = "path")
    })
    Result<Integer> confimTransferPositionByEmpId(String empId);

    /**
     * 批量确认调岗
     *
     * @param empIds 员工id数组
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "批量确认调岗")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empIds", dataType = "String[]", value = "员工id数组", paramType = "body")
    })
    Result<Integer> batchConfirmTransferPosition(String[] empIds);

    /**
     * 批量撤销调岗
     *
     * @param empIds 员工人事变动记录
     * @return 更新数量
     */
    @ApiOperation(value = "批量撤销调岗")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empIds", dataType = "String[]", value = "员工id数组", paramType = "body")
    })
    Result<String> batchRevokeTransferPositionByEmpId(String[] empIds);


    /**
     * 撤销调岗
     *
     * @param empId 员工id
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "根据员工id撤销调岗")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empId", dataType = "String", value = "员工id", paramType = "path")
    })
    Result<String> revokeTransferPositionByEmpId(String empId);

    /**
     * 批量离职
     *
     * @param empChangesAddDTO 离职信息
     * @return 离职结果
     */
    @ApiOperation(value = "批量离职")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesAddDTO", dataType = "EmpChangesAddDTO", value = "离职", paramType = "body")
    })
    Result<String> batchLeavePosition(@Valid @RequestBody EmpChangesAddDTO empChangesAddDTO);

    /**
     * 离职
     *
     * @param empChangesAddDTO 离职信息
     * @return 离职结果
     */
    @ApiOperation(value = "离职")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesAddDTO", dataType = "EmpChangesAddDTO", value = "离职", paramType = "body")
    })
    Result<String> leavePosition(@Valid @RequestBody EmpChangesAddDTO empChangesAddDTO);

    /**
     * 确认离职
     *
     * @param empChangesId 员工人事变动记录id
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "确认离职")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesId", dataType = "String", value = "员工人事变动记录id", paramType = "path")
    })
    Result<String> confimLeave(String empChangesId);

    /**
     * 撤销离职
     *
     * @param empChangesId 员工人事变动记录id
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "撤销离职")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empChangesId", dataType = "String", value = "员工人事变动记录id", paramType = "path")
    })
    Result<String> revokeLeave(String empChangesId);

    /**
     * 确认离职
     *
     * @param confirmLeaveOfficeDTO 确认离职参数
     * @param empId                 员工id
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "根据员工Id确认离职")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "confirmLeaveOfficeDTO", dataType = "ConfirmLeaveOfficeDTO", value = "确认离职参数", paramType = "body"),
            @ApiImplicitParam(name = "empId", dataType = "String", value = "员工id", paramType = "path")
    })
    Result<List<ConfirmLeaveOfficeListVO>> confirmLeaveByEmpId(ConfirmLeaveOfficeDTO confirmLeaveOfficeDTO, String empId);

    /**
     * 确认离职(批量)
     *
     * @param confirmLeaveOfficeDTO 确认离职参数
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "根据员工Id确认离职(批量)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "confirmLeaveOfficeDTO", dataType = "ConfirmLeaveOfficeDTO", value = "确认离职参数", paramType = "body")
    })
    Result<List<ConfirmLeaveOfficeListVO>> confirmLeaveByEmpIds(ConfirmLeaveOfficeDTO confirmLeaveOfficeDTO);


    /**
     * 导出错误列表
     *
     * @param errorList 错误列表
     * @return Excel
     */
    @ApiOperation(value = "导出错误列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "errorList", dataType = "List", value = "错误列表", paramType = "body")
    })
    ResponseEntity<Resource> exportErrorList(ImportExcelResultListVO<EmpChangeImportDTO> errorList);

    /**
     * 导入EXCEL
     *
     * @param file      文件
     * @param companyId 公司Id
     * @return 导入结果
     */
    @ApiOperation(value = "导入 EXCEL 并入库")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file", dataType = "MultipartFile", value = "确认离职EXCEL", paramType = "body"),
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "公司Id", paramType = "query")
    })
    Result<ImportExcelResultListVO<EmpChangeImportDTO>> importEmpChangeFile(MultipartFile file, String companyId);


    /**
     * 批量撤销离职
     *
     * @param empIds 员工ids
     * @return 更新数量
     */
    @ApiOperation(value = "批量撤销离职")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empIds", dataType = "String[]", value = "员工ids", paramType = "body")
    })
    Result<String> batchRevokeLeaveByEmpId(String[] empIds);

    /**
     * 撤销离职
     *
     * @param empId 员工id
     * @return 员工人事变动记录详情
     */
    @ApiOperation(value = "根据员工Id撤销离职")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empId", dataType = "String", value = "员工id", paramType = "path")
    })
    Result<String> revokeLeaveByEmpId(String empId);

    /**
     * 已离职列表
     *
     * @param companyId 公司ID
     * @return 已离职列表
     */
    @ApiOperation(value = "已离职列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "公司ID", paramType = "path"),
            @ApiImplicitParam(name = "empChangesQuery", dataType = "EmpChangesQuery", value = "员工人事变动记录查询参数", paramType = "query")
    })
    Result<Page<EmpChangesRelationVO>> pageEmpResignedList(
            @PathVariable String companyId,
            EmpChangesQuery empChangesQuery
    );

    /**
     * 已调岗列表
     *
     * @param companyId 公司ID
     * @return 已调岗列表
     */
    @ApiOperation(value = "已调岗列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "公司ID", paramType = "path"),
            @ApiImplicitParam(name = "empChangesQuery", dataType = "EmpChangesQuery", value = "员工人事变动记录查询参数", paramType = "query")
    })
    Result<Page<EmpChangesRelationVO>> pageEmpTransferList(
            @PathVariable String companyId,
            EmpChangesQuery empChangesQuery
    );
}

